#include <bits/stdc++.h>
using namespace std;
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long exp(long long a, long long b, long long m) {
  if (b == 0) return 1;
  if (b == 1) return mod(a, m);
  long long k = mod(exp(a, b / 2, m), m);
  if (b & 1) {
    return mod(a * mod(k * k, m), m);
  } else
    return mod(k * k, m);
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long h, n;
  cin >> h >> n;
  vector<long long> v(n + 1), dmg(n);
  v[0] = 0;
  long long fr = h;
  long long md = 0;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    fr += x;
    md = max(h - fr, md);
    if (fr <= 0) {
      cout << i << "\n";
      return 0;
    }
    v[i] = v[i - 1] + x;
    dmg[i - 1] = x;
  }
  if (v[n] >= 0) {
    cout << -1 << "\n";
    return 0;
  }
  long long resp = (h - md) / abs(v[n]) + ((h - md) % (abs(v[n])) ? 1 : 0);
  h += resp * (v[n]);
  resp *= n;
  if (h <= 0) {
    cout << resp << "\n";
    return 0;
  }
  for (long long i = 0; i < n; i++) {
    resp++;
    h += dmg[i];
    if (h <= 0) {
      cout << resp << "\n";
      return 0;
    }
  }
}
