#include <stdio.h>

int isSubsequence(const int sa[], int a, const int sb[], int b) {
    int i = 0, j = 0;
    while (i < a && j < b) {
        if (sa[i] == sb[j]) {
            j++;
        }
        i++;
    }
    return j == b;
}

int main() {
    while (1) {
        int a, b;
        scanf("%d %d", &a, &b);

        if (a == 0 && b == 0) {
            break;
        }

        int sa[a], sb[b];

        for (int i = 0; i < a; ++i) {
            scanf("%d", &sa[i]);
        }

        for (int i = 0; i < b; ++i) {
            scanf("%d", &sb[i]);
        }

        int result = isSubsequence(sa, a, sb, b);

        if (result) {
            printf("Sim\n");
        } else {
            printf("Nao\n");
        }
    }

    return 0;
}