#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p;
  cin >> n >> p;
  char c[n][p];
  int l[n / p + 1];
  int cont = 0;
  bool a = false;
  for (int i = 0;; i++) {
    for (int j = 0; j < p; j++) {
      cin >> c[i][j];
      if (++cont == n) {
        a = true;
        break;
      }
    }
    if (a) break;
  }
  int f = (n % p == 0) ? n / p : n / p + 1;
  cont = p;
  bool possible = false;
  a = false;
  for (int j = 0; j < p; j++) {
    for (int i = 1; i < f; i++) {
      if (c[i][j] != c[0][j]) {
        if (c[i][j] == '.') {
          if (c[0][j] == '0') {
            c[i][j] == '1';
            possible = true;
            break;
          } else {
            c[i][j] == '0';
            possible = true;
            break;
          }
        } else if (c[0][j] == '.') {
          if (c[i][j] == '0')
            c[0][j] = '1';
          else
            c[0][j] = '0';
          possible = true;
          break;
        } else {
          possible = true;
          break;
        }
      } else if (c[i][j] == '.' && c[0][j] == '.') {
        c[i][j] = '0';
        c[0][j] = '1';
        possible = true;
        break;
      }
      cont++;
      if (cont >= n) {
        a = true;
        break;
      }
    }
    if (possible) break;
    if (a) break;
  }
  if (possible) {
    string s = "";
    for (int i = 0; i < n; i++) {
      char c2 = c[i / p][i % p];
      if (c2 == '.') {
        if (i >= p && s[i - p] == '0')
          s += "1";
        else
          s += "0";
      } else if (c2 == '1')
        s += "1";
      else
        s += "0";
    }
    cout << s << '\n';
  } else
    cout << "No" << '\n';
}
