#include <bits/stdc++.h>
using namespace std;
inline void srand() {
  srand(chrono::high_resolution_clock::now().time_since_epoch().count());
}
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& v) {
  os << "(" << v.first << "," << v.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (const T& it : v) os << it << " ";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& v) {
  os << "{ ";
  for (const T& it : v) os << it << " ";
  os << "}";
  return os;
}
template <class T, class U>
ostream& operator<<(ostream& os, const map<T, U>& v) {
  os << "{ ";
  for (const pair<T, U>& it : v)
    os << "{" << it.first << "," << it.second << "} ";
  os << "}";
  return os;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
const long long INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3f;
const long long MOD = 1e9 + 7;
const long double EPS = 1e-9;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  srand();
  long long n, k;
  cin >> n >> k;
  long long c[k + 1], a[k + 1];
  long long curmin = 0;
  long long ans = -1;
  a[0] = INFLL;
  for (int i = 1; i <= k; i++) {
    cin >> c[i];
    a[i] = n % c[i];
    if (a[i] < a[curmin]) {
      curmin = i;
      ans = n / c[i];
    }
  }
  cout << curmin << " " << ans << endl;
  return 0;
}
