#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, sum = 0, m = 1, minimum = INT_MAX;
  cin >> n >> k;
  long long int arr[k + 5];
  for (long long int i = 1; i <= k; i++) {
    cin >> arr[i];
    long long int a = n / arr[i];
    if (a * arr[i] > sum) {
      m = i;
      sum = a * arr[i];
    }
  }
  for (long long int i = 1; i <= k; i++) {
    minimum = min(minimum, arr[i]);
  }
  long long int p = n / arr[m];
  cout << m << " " << p;
}
