#include <iostream>
#include <vector>

using namespace std;

bool isSubsequence(const vector<int>& sa, const vector<int>& sb) {
    int i = 0, j = 0;
    while (i < sa.size() && j < sb.size()) {
        if (sa[i] == sb[j]) {
            j++;
        }
        i++;
    }
    return j == sb.size();
}

int main() {
    while (true) {
        int a, b;
        cin >> a >> b;

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

        vector<int> sa(a), sb(b);

        for (int i = 0; i < a; ++i) {
            cin >> sa[i];
        }

        for (int i = 0; i < b; ++i) {
            cin >> sb[i];
        }

        bool result = isSubsequence(sa, sb);

        if (result) {
            cout << "Sim" << endl;
        }
        else {
            cout << "Nao" << endl;
        }
    }

    return 0;
}
