#include <bits/stdc++.h>
using namespace std;
const int MAXN = 520;
const int INF = 1000000000;
int mat[MAXN][MAXN], cost[MAXN][MAXN], flow[MAXN][MAXN];
int a[500], b[500];
int getV(int x) {
  int t = 0;
  while (x) {
    t += (x % 2);
    x /= 2;
  }
  return t;
}
int minCostMaxFlow(int n, const int mat[][MAXN], int cost[][MAXN], int source,
                   int sink, int flow[][MAXN], int& netcost) {
  int pre[MAXN], min[MAXN], d[MAXN], i, j, t, tag;
  if (source == sink) {
    return INF;
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; flow[i][j++] = 0)
      ;
  }
  for (netcost = 0;;) {
    for (i = 0; i < n; i++) {
      pre[i] = 0;
      min[i] = INF;
    }
    pre[source] = source + 1;
    min[source] = 0;
    d[source] = INF;
    for (tag = 1; tag;) {
      for (tag = t = 0; t < n; t++) {
        if (d[t]) {
          for (i = 0; i < n; i++) {
            if ((j = mat[t][i] - flow[t][i]) && min[t] + cost[t][i] < min[i]) {
              tag = 1;
              min[i] = min[t] + cost[t][i];
              pre[i] = t + 1;
              d[i] = d[t] < j ? d[t] : j;
            } else if ((j = flow[i][t]) && min[t] < INF &&
                       min[t] - cost[i][t] < min[i]) {
              tag = 1;
              min[i] = min[t] - cost[i][t];
              pre[i] = -t - 1;
              d[i] = d[t] < j ? d[t] : j;
            }
          }
        }
      }
    }
    if (!pre[sink]) {
      break;
    }
    for (netcost += min[sink] * d[i = sink]; i != source;) {
      if (pre[i] > 0) {
        flow[pre[i] - 1][i] += d[sink];
        i = pre[i] - 1;
      } else {
        flow[i][-pre[i] - 1] -= d[sink];
        i = -pre[i] - 1;
      }
    }
  }
  for (j = i = 0; i < n; j += flow[source][i++])
    ;
  return j;
}
int main() {
  int i, j, k, m, n, netcost;
  while (cin >> n >> m) {
    for (i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
      b[i] = getV(a[i]);
    }
    memset(mat, 0, sizeof(mat));
    memset(cost, 0, sizeof(cost));
    mat[0][2 * n + 1] = m;
    for (i = 1; i <= n; ++i) {
      mat[0][i] = 1;
      mat[2 * n + 1][n + i] = 1;
      cost[2 * n + 1][n + i] = b[i];
      mat[n + i][2 * n + 2] = 1;
      for (j = i + 1; j <= n; ++j) {
        mat[i][j + n] = 1;
        if (a[i] == a[j])
          cost[i][j + n] = 0;
        else
          cost[i][j + n] = b[j];
      }
    }
    minCostMaxFlow(2 * n + 3, mat, cost, 0, 2 * n + 2, flow, netcost);
    int nn = 0, val[30], ans[260], res = 0, len = 0;
    for (i = 1; i <= n; ++i) {
      if (flow[2 * n + 1][n + i] == 1) {
        res += b[i];
        ++len;
      } else {
        for (j = 1;; ++j) {
          if (flow[j][n + i] == 1) break;
        }
        if (a[j] != a[i]) {
          ++len;
          res += b[i];
        }
      }
    }
    cout << len + n << " " << res << endl;
    for (i = 1; i <= n; ++i) {
      if (flow[2 * n + 1][n + i] == 1) {
        ans[i] = nn++;
        printf("%c=%d\n", 'a' + ans[i], a[i]);
        printf("print(%c)\n", 'a' + ans[i]);
      } else {
        for (j = 1;; ++j) {
          if (flow[j][n + i] == 1) break;
        }
        ans[i] = ans[j];
        if (a[j] != a[i]) {
          printf("%c=%d\n", 'a' + ans[i], a[i]);
          printf("print(%c)\n", 'a' + ans[i]);
        } else
          printf("print(%c)\n", 'a' + ans[i]);
      }
    }
  }
}
