#include <bits/stdc++.h>
using namespace std;
const int INF = 1029384756;
const double PI = acos(-1);
const double EPS = 0.0000000304;
const int MAX = 522;
int V, N, K, S, T;
int ff[MAX][MAX], cc[MAX][MAX];
int ip[MAX];
int bk[MAX], bf[MAX];
int dis[MAX];
int nc, nf;
int ls[MAX], sp[MAX];
int rb[MAX];
int bit(int a) {
  int t = 0;
  while (a) {
    a -= (a & (-a));
    t++;
  }
  return t;
}
bool nagareru() {
  for (int(i) = 0; (i) < (V); (i)++) {
    dis[i] = INF;
  }
  queue<int> qe;
  qe.push(S);
  dis[S] = 0;
  bf[S] = INF;
  while (qe.size()) {
    int nv = qe.front();
    qe.pop();
    for (int(i) = 0; (i) < (V); (i)++) {
      if (ff[nv][i] && dis[i] > dis[nv] + cc[nv][i]) {
        dis[i] = dis[nv] + cc[nv][i];
        bk[i] = nv;
        bf[i] = min(ff[nv][i], bf[nv]);
        qe.push(i);
      }
    }
  }
  if (dis[T] > 123123) {
    return 0;
  } else {
    int nv = T;
    nf += bf[T];
    while (nv != S) {
      if (nv >= N && nv < 2 * N) {
        rb[nv - N] = bk[nv] + 1;
      }
      nc += cc[bk[nv]][nv];
      ff[bk[nv]][nv] -= bf[T];
      ff[nv][bk[nv]] += bf[T];
      nv = bk[nv];
    }
    return 1;
  }
}
int main() {
  scanf("%d%d", &N, &K);
  for (int(i) = 0; (i) < (N); (i)++) {
    scanf("%d", ip + i);
  }
  S = N * 2;
  T = S + 1;
  for (int(i) = 0; (i) < (N); (i)++) {
    ff[S][i] = 1;
    ff[N + i][T] = 1;
  }
  for (int(i) = 0; (i) < (N); (i)++) {
    for (int(j) = (i + 1); (j) < (N); (j)++) {
      ff[i][N + j] = 1;
      if (ip[i] == ip[j]) {
        cc[i][N + j] = -bit(ip[j]);
        cc[N + j][i] = bit(ip[j]);
      }
    }
  }
  ff[S][T] = K;
  T++;
  ff[T - 1][T] = N;
  V = N * 2 + 3;
  while (nagareru())
    ;
  for (int(i) = 0; (i) < (N); (i)++) {
    nc += bit(ip[i]);
  }
  memset((ls), -1, sizeof(ls));
  int a = 0;
  int ans = 0;
  for (int(i) = 0; (i) < (N); (i)++) {
    if (!rb[i]) {
      sp[i] = a;
      ls[a] = i;
      a++;
    } else {
      sp[i] = sp[rb[i] - 1];
      ls[sp[i] - 1] = ls[i];
    }
    if ((!rb[i]) || (ip[rb[i] - 1] != ip[i])) {
      ans++;
    }
    ans++;
  }
  printf("%d %d\n", ans, nc);
  for (int(i) = 0; (i) < (N); (i)++) {
    if ((!rb[i]) || (ip[rb[i] - 1] != ip[i])) {
      printf("%c=%d\n", sp[i] + 'a', ip[i]);
    }
    printf("print(%c)\n", sp[i] + 'a');
  }
  return 0;
}
