#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, r, acum;
  cin >> N;
  int a[7];
  acum = 0;
  for (int i = 0; i < 7; i++) {
    cin >> a[i];
    acum += a[i];
  }
  r = N % acum;
  if (r == 0) {
    int i = 6;
    while (i >= 0 && a[i] == 0) i--;
    r = i + 1;
  } else {
    int i = 0;
    for (int j = 1; j < 7; j++) a[j] += a[j - 1];
    while (i < 7 && a[i] < r) i++;
    r = i + 1;
  }
  cout << r << '\n';
}
