#include <bits/stdc++.h>
using namespace std;
int KM(int m, int n, int mat[][310], int *match1, int *match2) {
  int s[310], t[310], l1[310], l2[310];
  int p, q, i, j, k, ret = 0;
  for (i = 0; i < m; i++) {
    l1[i] = -0x3f3f3f3f;
    for (j = 0; j < n; j++) l1[i] = mat[i][j] > l1[i] ? mat[i][j] : l1[i];
    if (l1[i] == -0x3f3f3f3f) return -1;
  }
  for (i = 0; i < n; i++) l2[i] = 0;
  memset(match1, -1, sizeof(int) * 310);
  memset(match2, -1, sizeof(int) * 310);
  for (i = 0; i < m; i++) {
    memset(t, -1, sizeof(int) * 310);
    p = 0;
    q = 0;
    for (s[0] = i; p <= q && match1[i] < 0; p++) {
      for (k = s[p], j = 0; j < n && match1[i] < 0; j++) {
        if (l1[k] + l2[j] == mat[k][j] && t[j] < 0) {
          s[++q] = match2[j];
          t[j] = k;
          if (s[q] < 0) {
            for (p = j; p >= 0; j = p) {
              match2[j] = k = t[j];
              p = match1[k];
              match1[k] = j;
            }
          }
        }
      }
    }
    if (match1[i] < 0) {
      i--;
      p = 0x3f3f3f3f;
      for (k = 0; k <= q; k++) {
        for (j = 0; j < n; j++) {
          if (t[j] < 0 && l1[s[k]] + l2[j] - mat[s[k]][j] < p)
            p = l1[s[k]] + l2[j] - mat[s[k]][j];
        }
      }
      for (j = 0; j < n; j++) l2[j] += t[j] < 0 ? 0 : p;
      for (k = 0; k <= q; k++) l1[s[k]] -= p;
    }
  }
  for (i = 0; i < m; i++) ret += mat[i][match1[i]];
  return ret;
}
int mat[310][310], match1[310], match2[310];
int cost[310], num[310], pre[310];
int main() {
  int n, m, i, j;
  scanf("%d%d", &n, &m);
  memset(cost, 0, sizeof(cost));
  for (i = 0; i < n; ++i) {
    scanf("%d", num + i);
    int x = num[i];
    while (x) cost[i]++, x -= x & -x;
  }
  memset(mat, -0x3f, sizeof(mat));
  for (i = 0; i < n; ++i)
    for (j = 0; j < m; ++j) mat[i][j] = -cost[i];
  for (i = 1; i < n; ++i)
    for (j = 0; j < i; ++j) {
      if (num[i] == num[j])
        mat[i][j + m] = 0;
      else
        mat[i][j + m] = -cost[i];
    }
  int allcost = -KM(n, n + m, mat, match1, match2);
  int line = n;
  for (i = 0; i < n; ++i)
    if (match1[i] < m || num[match1[i] - m] != num[i]) line++;
  printf("%d %d\n", line, allcost);
  for (i = 0; i < n; ++i) {
    if (match1[i] < m) {
      printf("%c=%d\n", 'a' + match1[i], num[i]);
      printf("print(%c)\n", 'a' + match1[i]);
      pre[i] = match1[i];
    } else {
      pre[i] = pre[match1[i] - m];
      if (num[i] != num[match1[i] - m]) {
        printf("%c=%d\n", 'a' + pre[i], num[i]);
        printf("print(%c)\n", 'a' + pre[i]);
      } else
        printf("print(%c)\n", 'a' + pre[i]);
    }
  }
}
