#include <bits/stdc++.h>   using namespace std;   long long n, k, res = 1;   long long a[100005];   long long b[100005];   long long d = 1, ans;   int main() {     cin >> n >> k;     for (int i = 0; i < k; i++) d *= 10;     for (int i = 0; i < n / k; i++) cin >> a[i];     for (int i = 0; i < n / k; i++) cin >> b[i];     for (int i = 0; i < n / k; i++) {       ans = (d - 1) / a[i] + 1;       if (b[i] == 0)         ans -= ((d / 10) - 1) / a[i] + 1;       else         ans -=             ((b[i] + 1) * (d / 10) - 1) / a[i] - ((b[i]) * (d / 10) - 1) / a[i];       res = (res * ans) % (1000000007);     }     cout << res;     return 0;   }   