#include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	bool b[1010] = {};//??±????????????
	for (int m, n; cin >> m >> n&&m;) {
		memset(b, 0, sizeof(b));
		int cnt = 0;
		int j = 0;
		rep(i, 1, n + 1) {
			//dump(i);
			//dump(j);
			string s; cin >> s;
			if (cnt == m - 1)continue;
			string t = to_string(i);
			if (i % 3 == 0 && i % 5 == 0)t = "FizzBuzz";
			else if (i % 3 == 0)t = "Fizz";
			else if (i % 5 == 0)t = "Buzz";

			if (s != t) {
				b[j] = true;
				cnt++;
			}
			(++j) %= m;
			while (b[j])(++j) %= m;
			//dumpc(b);
		}
		vector<int> ans;
		rep(i, 0, m) {
			if (!b[i])ans.push_back(i + 1);
		}
		sort(all(ans));
		cout << ans[0];
		rep(i, 1, ans.size())cout << " " << ans[i];
		cout << endl;
	}
	return 0;
}