import java.io.*; import java.util.*; public class goofy { private static final int END = -1; private static final int BAD = -2; private static final Scanner cin = new Scanner(System.in); public static void main(String[] args) { while(true) { int n = cin.nextInt(); int m = cin.nextInt(); if(n == 0 && m == 0) { break; } int[] l = new int[n]; for(int i = 0; i < n; i++) { l[i] = cin.nextInt(); } int[][] dp = new int[n][1 << m]; for(int j = 0; j < (1 << m); j++) { dp[0][j] = (Integer.bitCount(j) == l[0]) ? END : BAD; } for(int i = 1; i < n; i++) { for(int j = 0; j < (1 << m); j++) { dp[i][j] = BAD; if(Integer.bitCount(j) == l[i]) { int j0 = (j >> 1) | (0 << (m - 1)); int j1 = (j >> 1) | (1 << (m - 1)); if(dp[i-1][j0] != BAD) { dp[i][j] = 0; } if(dp[i-1][j1] != BAD) { dp[i][j] = 1; } } } } int bgn = BAD; for(int j = 0; j < (1 << m); j++) { if(dp[n-1][j] != BAD) { bgn = j; break; } } if(bgn != BAD) { int[] ans = new int[n]; int k = bgn; for(int i = n - 1; i >= 1; i--) { ans[i] = dp[i][k]; k = (k >> 1) | (dp[i][k] << (m - 1)); } StringBuffer sb = new StringBuffer(); for(int i = 1; i < n; i++) { sb.append(ans[i]); } String tmp = Integer.toString(bgn, 2); for(int i = 0; i < m - tmp.length(); i++) { sb.append('0'); } sb.append(tmp); System.out.println(sb); } else { System.out.println("Goofy"); } } } }