#include using namespace std; typedef long long ll; int main(){ int N,K; cin >> N >> K; int M = (int)ceil(sqrt((double)N)); M = max(M, (int)ceil((double)(N/K))); cout << M << endl; vector> S(M,vector(M,'.')); int c = N; int pos = 0; for(int i = 0; i < M; i++){ //i行目を完成させる for(int j = pos; j < min(pos+K,M); j++){ S[i][j] = '#';} pos += K; pos %= M;} for(int i = 0; i < M; i++){ for(int j = 0; j < M; j++){ cout << S[i][j];} cout << endl; } return 0;}