#include <bits/stdc++.h>
using namespace std;
int vt, ve[(2 * 600 * 600)], re[(2 * 600 * 600)], ze[(2 * 600 * 600)],
    nextt[(2 * 600 * 600)];
int in[600], head[600], path[600], dis[600], qu[600], lim[600];
void init() {
  vt = 1;
  memset(head, 0, sizeof(head));
}
int auxm;
void add(int x, int y, int cap, int wei = 0) {
  ++auxm;
  ve[++vt] = y;
  re[vt] = cap;
  ze[vt] = wei;
  nextt[vt] = head[x];
  head[x] = vt;
  ve[++vt] = x;
  re[vt] = 0;
  ze[vt] = -wei;
  nextt[vt] = head[y];
  head[y] = vt;
}
int mfmc(int s, int t, int n, int &fcost) {
  int flow = fcost = 0;
  while (1) {
    int qt = 0, k = 0;
    qu[qt++] = s;
    for (int i = 0; i < n; i++) dis[i] = lim[i] = 0x3f3f3f3f;
    dis[s] = 0;
    while (k != qt) {
      if (k == 600) k = 0;
      int x = qu[k++];
      for (int i = head[x]; i; i = nextt[i])
        if (re[i] && dis[x] + ze[i] < dis[ve[i]]) {
          dis[ve[i]] = dis[x] + ze[i];
          path[ve[i]] = i;
          lim[ve[i]] = min(lim[x], re[i]);
          if (!in[ve[i]]) {
            if (qt == 600) qt = 0;
            qu[qt++] = ve[i];
            in[ve[i]] = 1;
          }
        }
      in[x] = 0;
    }
    if (dis[t] == 0x3f3f3f3f) break;
    int f = lim[t];
    for (int p = t; p != s; p = ve[path[p] ^ 1]) {
      re[path[p]] -= f;
      re[path[p] ^ 1] += f;
    }
    fcost += f * dis[t];
    flow += f;
  }
  return flow;
}
bool mark[600];
void DFS(int u) {
  mark[u] = true;
  for (int i = head[u]; i; i = nextt[i]) {
    if (i % 2) continue;
    int v = ve[i];
    if (!mark[v] && re[i] > 0) {
      DFS(v);
    }
  }
}
void mincut(int s, int t, int n) {
  memset(mark, 0, sizeof(mark));
  DFS(s);
  for (int i = 0; i < n; i++)
    for (int j = head[i]; j; j = nextt[j]) {
      if (j % 2) continue;
      int v = ve[j];
      if (mark[i] && !mark[v]) printf("%d %d\n", i, v);
    }
}
int v[300];
int aux[300];
int varval[300];
int var[300];
int main() {
  ios::sync_with_stdio(false);
  ;
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < (n); ++i) cin >> v[i];
  init();
  for (int i = 0; i < (m); ++i) {
    add(0, i + 1, 1);
    for (int j = 0; j < (n); ++j)
      add(i + 1, m + n + 1 + j, 1, __builtin_popcount(v[j]));
  }
  for (int i = 0; i < (n); ++i) {
    add(0, m + 1 + i, 1);
    add(m + n + 1 + i, m + 2 * n + 1, 1);
    for (int j = i + 1; j < (n); ++j) {
      int cost = v[i] == v[j] ? 0 : __builtin_popcount(v[j]);
      add(m + 1 + i, m + n + 1 + j, 1, cost);
    }
  }
  int fcost, flow = mfmc(0, m + 2 * n + 1, m + 2 * n + 2, fcost);
  for (int i = 1; i <= auxm; i++) {
    int u = ve[2 * i + 1];
    int v = ve[2 * i];
    int f = re[2 * i + 1];
    if (f == 1 && v >= m + n + 1 && v <= m + 2 * n) {
      aux[v - m - n - 1] = u;
    }
  }
  vector<string> ans;
  memset(varval, -1, sizeof(varval));
  for (int i = 0; i < (n); ++i) {
    int u = aux[i];
    if (u >= 1 && u <= m) {
      varval[u - 1] = v[i];
      string str;
      str += (char)('a' + u - 1);
      str += "=";
      str += to_string(v[i]);
      ans.push_back(str);
      var[i] = u - 1;
    } else {
      var[i] = var[u - m - 1];
      if (varval[var[i]] != v[i]) {
        string str;
        str += (char)('a' + var[i]);
        str += "=";
        str += to_string(v[i]);
        ans.push_back(str);
        varval[var[i]] = v[i];
      }
    }
    string str = "print(";
    str += (char)('a' + var[i]);
    str += ")";
    ans.push_back(str);
  }
  cout << ans.size() << " " << fcost << "\n";
  for (__typeof((ans).begin()) it = (ans).begin(); it != (ans).end(); ++it)
    cout << *it << endl;
}
