#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
unsigned long long int a[maxn];
int main() {
  unsigned long long int n;
  int k;
  while (cin >> n) {
    cin >> k;
    int index = 1;
    unsigned long long int min_num = 10000000000000000005;
    for (int i = 1; i <= k; i++) {
      cin >> a[i];
      if (min_num >= n % a[i]) {
        index = i;
        min_num = n % a[i];
      }
    }
    cout << index << " " << (n - min_num) / a[index] << endl;
  }
}
