N, K = map(int, input().split()) sq = 0 for i in range(100): if (sq + 1) ** 2 < N: sq += 1 M = max(sq + 1, (N + K - 1)//K) cnt = 0 print(M) for i in range(M): ans = ["."] * M for j in range(min(M, K)): if cnt == N: continue ans[(i + j)%M] = "#" cnt += 1 print(*ans, sep="")