#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long power(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans *= a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}
long long powm(long long a, long long b) {
  a %= MOD;
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return ans;
}
void IO() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  IO();
  ;
  long long n, k;
  cin >> n >> k;
  long long A[k];
  for (long long &x : A) cin >> x;
  long long pos = 0, res = LLONG_MAX;
  for (long long i = 0; i < k; i++) {
    if (n % A[i] < res) {
      pos = i + 1;
      res = n % A[i];
    }
  }
  cout << pos << " " << n / A[pos - 1] << "\n";
  return 0;
}
