// stones atcoder
const long long c {1e10 + 7};
#include<bits/stdc++.h>
using namespace std;
bool true_if_p1_wins(bool true_if_p1_plays, int stones_left) {
	if (stones_left < min) {
		return !true_if_p1_plays;
	}
	else if (true_if_p1_plays) {
		bool or_of_all{false};
		for (auto x : v) {
			if (x <= stones_left) {
				or_of_all = or_of_all || true_if_p1_wins(false, stones_left - x);
			}
		}
		return or_of_all;
	}
	else {
		bool and_of_all{true};
		for (auto x : v) {
			if (x < stones_left) {
				and_of_all = and_of_all && true_if_p1_wins(true, stones_left - x);
			}
		}
		return and_of_all;
	}
}
int main() {
	int n, initial_stones;
	cin >> n >> initial_stones;
	vector<int> v(n);
	for (int i{}; i < n; i++) {
		cin >> v[i];
	}
	int min{min_element(v.begin(), v.end())};
	if (true_if_p1_wins(true, initial_stones, min)) {
		cout << "p1 wins" << endl;
	}
	else {
		cout << "p2 wins" << endl;
	}
}