#include <bits/stdc++.h>
using namespace std;
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<T> &v) {
  for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
    out << v[i] << " ";
  out << "\n";
  return out;
}
template <typename T>
std::ostream &operator<<(std::ostream &out, vector<vector<T> > &v) {
  for (size_t i = 0; i < v.size(); ++i) {
    for (size_t j = 0; j < v[i].size(); ++j) {
      out << v[i][j] << " ";
    }
    out << "\n";
  }
  return out;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> capacities(k);
  for (int i = 0; i < k; ++i) cin >> capacities[i];
  int type = 0;
  long long box_count = 0;
  long long min_diff = 1e18, curr_diff;
  for (int i = 0; i < k; ++i) {
    curr_diff = n - (n / capacities[i] * capacities[i]);
    if (curr_diff < min_diff) {
      type = i + 1;
      box_count = n / capacities[i];
      min_diff = curr_diff;
    }
  }
  cout << type << " " << box_count << "\n";
  return 0;
}
