#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int mod = 998244353;
void flash() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(9);
}
void solve();
int32_t main() {
  flash();
  int t;
  t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
void solve() {
  long long n, k;
  cin >> n >> k;
  long long a[k];
  for (int i = 0; i < k; i++) cin >> a[i];
  long long ind = -1;
  long long maxh = -1;
  long long rem = 1e18;
  for (int i = 0; i < k; i++) {
    if (rem > n % a[i]) {
      maxh = n / a[i];
      ind = i;
      rem = n % a[i];
    }
  }
  cout << ind + 1 << " " << maxh;
  return;
}
