#include <bits/stdc++.h>
using namespace std;
int _;
const int MAXN = 200 * 1000;
int n, m;
int tree[MAXN + 1];
void Add(int x, int val) {
  for (; x <= n; x += x & (-x)) tree[x] += val;
}
int Get(int x) {
  int ans = 0;
  for (; x; x -= x & (-x)) ans += tree[x];
  return ans;
}
int p[MAXN + 1], pos[MAXN + 1];
vector<int> v[MAXN + 1];
vector<pair<int, int> > q[MAXN + 1];
int ans[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (__typeof(n) i = (1); i <= (n); ++i) {
    cin >> p[i];
    pos[p[i]] = i;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j * i <= n; ++j) {
      int x = pos[i], y = pos[j * i];
      if (x > y) swap(x, y);
      v[x].push_back(y);
    }
  for (__typeof(m) i = (0); i < (m); ++i) {
    int l, r;
    cin >> l >> r;
    q[l].push_back(pair<int, int>(r, i));
  }
  for (int i = n; i >= 1; --i) {
    for (int j = 0; j < ((int)(v[i]).size()); ++j) {
      Add(v[i][j], 1);
    }
    for (int j = 0; j < ((int)(q[i]).size()); ++j) {
      ans[q[i][j].second] = Get(q[i][j].first);
    }
  }
  for (__typeof(m) i = (0); i < (m); ++i) cout << ans[i] << endl;
  return 0;
}
