#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10005;
const int MAXM = 500005;
const int INF = 1e9;
int pre[MAXN], dis[MAXN];
int po[MAXN], tol;
bool use[MAXN];
int q[MAXM], head, tail;
int n, m, vs, vt, ans;
struct node {
  int y, f, cost, next;
} edge[MAXM];
void Add(int x, int y, int f, int cost) {
  edge[++tol].y = y;
  edge[tol].f = f;
  edge[tol].cost = cost;
  edge[tol].next = po[x];
  po[x] = tol;
}
void add(int x, int y, int f, int cost) {
  Add(x, y, f, cost);
  Add(y, x, 0, -cost);
}
bool spfa() {
  memset(use, false, sizeof(use));
  for (int i = 1; i <= vt; i++) dis[i] = INF;
  dis[vs] = 0;
  head = tail = 0;
  q[tail++] = vs;
  pre[vs] = 0;
  while (head < tail) {
    int x = q[head++];
    use[x] = false;
    for (int i = po[x]; i; i = edge[i].next) {
      int y = edge[i].y;
      if (edge[i].f > 0 && edge[i].cost + dis[x] < dis[y]) {
        dis[y] = dis[x] + edge[i].cost;
        pre[y] = i;
        if (!use[y]) {
          use[y] = true;
          q[tail++] = y;
        }
      }
    }
  }
  if (dis[vt] == INF) return false;
  int aug = INF;
  for (int i = pre[vt]; i; i = pre[edge[i ^ 1].y]) aug = min(aug, edge[i].f);
  for (int i = pre[vt]; i; i = pre[edge[i ^ 1].y]) {
    edge[i].f -= aug;
    edge[i ^ 1].f += aug;
  }
  ans += dis[vt] * aug;
  return true;
}
int a[MAXN];
int cnt(int x) {
  int ans = 0;
  while (x) {
    ans += x & 1;
    x >>= 1;
  }
  return ans;
}
string vec[MAXN];
int fa[MAXN];
string cc(int n) {
  string s;
  while (n) {
    s.push_back(char(n % 10 + '0'));
    n /= 10;
  }
  reverse(s.begin(), s.end());
  return s;
}
int tmp[MAXN];
int val[MAXN];
int main() {
  int ncase = 0;
  while (cin >> n >> m) {
    ncase ? puts("------------------------") : ncase = 1;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    memset(po, 0, sizeof(po));
    tol = 1;
    vs = MAXN - 5;
    vt = vs + 1;
    for (int i = 1; i <= n; i++) {
      add(vs, i, 1, 0);
      for (int j = i + 1; j <= n; j++)
        add(i, j + n, 1, a[i] == a[j] ? 0 : cnt(a[j]));
      add(i + n, vt, 1, 0);
    }
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= n; j++) add(i + 2 * n, j + n, 1, cnt(a[j]));
      add(vs, i + 2 * n, 1, 0);
    }
    ans = 0;
    while (spfa())
      ;
    memset(val, 0, sizeof(val));
    for (int i = 2; i <= tol; i += 2) {
      int x = edge[i].y;
      int y = edge[i ^ 1].y;
      if (x == vs || y == vs || x == vt || y == vt) continue;
      if (edge[i].f) continue;
      fa[x] = y;
    }
    int top = 0;
    for (int i = 1; i <= n; i++) {
      int x = i + n;
      int y = fa[x];
      if (y > 2 * n) {
        string s;
        s.push_back(char('a' + y - 2 * n - 1));
        s += "=" + cc(a[i]);
        vec[top++] = s;
        s.clear();
        s = "print(";
        s.push_back(char('a' + y - 2 * n - 1));
        vec[top++] = s + ")";
        val[i] = y - 2 * n - 1;
        tmp[val[i]] = a[i];
      } else {
        string s;
        if (tmp[val[y]] == a[i]) {
          val[i] = val[y];
          s = "print(";
          s.push_back(char('a' + val[y]));
          vec[top++] = s + ")";
        } else {
          s.push_back(char('a' + val[y]));
          s += "=" + cc(a[i]);
          vec[top++] = s;
          s.clear();
          s = "print(";
          s.push_back(char('a' + val[y]));
          vec[top++] = s + ")";
          val[i] = val[y];
          tmp[val[i]] = a[i];
        }
      }
    }
    cout << top << " " << ans << endl;
    for (int i = 0; i < top; i++) cout << vec[i] << endl;
  }
  return 0;
}
