#include <bits/stdc++.h>
using namespace std;
void assignStdin() {
  cin.sync_with_stdio(false);
  cin.tie(nullptr);
}
bool isDebug() { return false; }
const int MAXN = 200008;
int idx[MAXN], data[MAXN], n, m, ql[MAXN], qr[MAXN], rs[MAXN];
vector<int> assoDivisor[MAXN], queries[MAXN], tree(MAXN);
int query(vector<int> &tree, int idx) {
  int rs = 0;
  for (int i = idx; i > 0; i -= i & -i) {
    rs += tree[i];
  }
  return rs;
}
void updateTree(vector<int> &tree, int idx, int value) {
  for (int i = idx; i < tree.size(); i += i & -i) {
    tree[i] += value;
  }
}
int main(int argc, char *argv[]) {
  assignStdin();
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> data[i];
    idx[data[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j += i) {
      if (idx[i] != 0 && idx[j] != 0) {
        assoDivisor[min(idx[i], idx[j])].push_back(max(idx[i], idx[j]));
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    cin >> ql[i] >> qr[i];
    queries[ql[i]].push_back(i);
  }
  for (int i = n; i >= 1; i--) {
    for (int assoIdx : assoDivisor[i]) {
      updateTree(tree, assoIdx, 1);
    }
    if (isDebug()) {
      for (int j = 1; j <= n; j++) {
        cout << tree[j] << " ";
      }
      cout << endl;
    }
    for (int qIdx : queries[i]) {
      rs[qIdx] = query(tree, qr[qIdx]);
    }
  }
  for (int i = 1; i <= m; i++) {
    cout << rs[i] << endl;
  }
}
