#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
  return a <= b ? true : false;
}
template <class T>
bool uax(T &a, T b) {
  return a >= b ? true : false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(10);
  cout << fixed;
  long long H;
  int n;
  cin >> H >> n;
  vector<long long> a(n);
  long long sum = 0;
  long long gap = 0;
  long long h = H;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum -= a[i];
    h += a[i];
    if (h <= 0) {
      cout << i + 1 << endl;
      return 0;
    }
    gap = max(gap, sum);
  }
  if (sum <= 0) {
    cout << -1 << endl;
    return 0;
  }
  long long whole = (H - gap) / sum;
  H -= whole * sum;
  long long result = whole * n;
  for (int i = 0;; i++) {
    H += a[i % n];
    result++;
    if (H <= 0) {
      cout << result << endl;
      break;
    }
  }
  return 0;
}
