#include <bits/stdc++.h>   using namespace std;   const int maxn = 100010;   const unsigned Upper = (1LL << 32) - 1;   unsigned a[maxn], b[maxn];   int main() {     int n, K;     int i, j;     unsigned s, a0, a1, a2, a3;     scanf( %d%d , &n, &K);     for (i = 0; i < n; ++i) {       scanf( %u.%u.%u.%u , &a0, &a1, &a2, &a3);       a[i] = (a0 << 24) + (a1 << 16) + (a2 << 8) + a3;     }     sort(a, a + n);     for (j = 31; j; --j) {       s = Upper >> j << j;       for (i = 0; i < n; ++i) b[i] = a[i] & s;       if (unique(b, b + n) - b == K) {         printf( %u.%u.%u.%u n , (s >> 24) & 255, (s >> 16) & 255, (s >> 8) & 255,                s & 255);         return 0;       }     }     puts( -1 );     return 0;   }   