#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;

int main() {
  int N, M;
  while(cin >> N >> M && (N || M)) {
    int bt = M;
    int bl = 1001;
    int a;
    typedef pair<pair<int, int>, int> P;
    vector<P> v;
    for(int i = 0; i < N; ++i) {
      cin >> a;
      int s = bt+(int)(bl > a);
      P p = make_pair(make_pair(min((M / a) * a,(s/a+(int)(s%a!=0))*a), a), i+1);
      v.push_back(p);
      bt = p.first.first; bl = p.first.second;
    }
    sort(v.begin(), v.end());
    if(v[0].first == v[1].first) cout << N << endl;
    else                         cout << v[0].second << endl;
  }
  return 0;
}