#include <bits/stdc++.h>
using namespace std;
bitset<1000001> prime;
void shomoy() {}
void seive() {
  prime[1] = 1;
  prime[2] = 0;
  for (int i = 3; i * i < 1000009; i += 2) {
    if (prime[i] == 0) {
      for (int j = i + i; j < 1000009; j += i) {
        prime[j] = 1;
      }
    }
  }
}
long long npr(long long n, long long r) {
  long long mul = 1;
  long long temp = 0;
  for (long long i = 0; i < r; i++) {
    mul *= (n - i);
  }
  return mul;
}
long long fact(int n) {
  long long mul = 1;
  for (int i = 1; i <= n; i++) {
    mul *= i;
  }
  return mul;
}
int main() {
  ios::sync_with_stdio();
  cin.tie(0);
  long long mn = 1000000000000000000, box = 1, ans = 0, n, k;
  cin >> n >> k;
  long long arr[k + 2];
  for (int i = 0; i < k; i++) {
    cin >> arr[i];
    if ((n % arr[i]) < mn) {
      mn = n % arr[i];
      box = i + 1;
      ans = n / arr[i];
    }
  }
  cout << box << " " << ans << "\n";
  shomoy();
  return 0;
}
