#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  long long n, m, k, l;
  cin >> n >> m >> k >> l;
  long long ans = n / m;
  if (ans * m - k < l) {
    cout << -1;
    return 0;
  }
  long long h = n;
  long long lw = 0;
  while (lw <= h) {
    long long mid = (h + lw) / 2;
    long long x = mid / m;
    if (x * m - k >= l) {
      ans = mid;
      h = mid - 1;
    } else {
      lw = mid + 1;
    }
  }
  if (l == 0) {
    cout << 0;
    return 0;
  }
  cout << ans / m;
  return 0;
}
