#include <cstdio>
#include <map>
#include <algorithm>
using namespace std;
int a[1001], b[1001];
pair<pair<int, int>, int> p[1001];
int main()
{
	int n, m, i;
	for (; ~scanf("%d%d", &n, &m),n; ) {
		for (i=0; i<n; ++i) scanf("%d", a+i);
		b[0] = m / a[0] * a[0];
		int min = b[0], minid = 0;
		for (i=1; i<n; ++i) {
			b[i] = 0;
			while (b[i] < min) b[i] += a[i];
			if (b[i] == min && b[i] + a[i] <= m && a[i] < a[minid])
				b[i] += a[i];
			if (b[i] > m) b[i] = m / a[i] * a[i];
			if (min > b[i]) { min = b[i]; minid = i; }
		}
		for (i=0; i<n; ++i) p[i] = make_pair(make_pair(b[i], a[i]), i+1);
		sort(p, p+n);

		int res = -1;
		if (p[0].first == p[1].first) 
			res = n;
		else
			res = p[0].second;
		printf("%d\n", res);
	}
	return 0;
}