Simple solution in Java. Beats 100 % 
Complexity

Time complexity:
O(m * n)


Space complexity:
O(1)

Code
# Complexity
- Time complexity:
O(m * n)

- Space complexity:
O(1)

# Code
```java []
class Solution {
    public int numberOfPairs(int[] nums1, int[] nums2, int k) {
        int goodPairs = 0;
        int n = nums1.length;
        int m = nums2.length;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (nums1[i] % (nums2[j] * k) == 0) {
                    goodPairs++;
                }
            }
        }
        return goodPairs;
    }
}
```
['Array', 'Java']