#include <bits/stdc++.h>
using namespace std;
const int MAXn = 1000;
const int INF = 1e9;
inline int in(int x) { return 2 * x; }
inline int out(int x) { return 2 * x + 1; }
int cap[MAXn][MAXn], cost[MAXn][MAXn];
int vn;
int dist[MAXn];
int rcap[MAXn][MAXn], rcost[MAXn][MAXn];
void bellman(int s) {
  for (int i = 0; i < vn; i++) dist[i] = INF;
  dist[s] = 0;
  for (int i = 0; i < vn - 1; i++)
    for (int j = 0; j < vn; j++)
      for (int k = 0; k < vn; k++)
        if (dist[j] != INF && rcap[j][k] != 0 &&
            dist[j] + rcost[j][k] < dist[k])
          dist[k] = dist[j] + rcost[j][k];
}
bool mark[MAXn];
void dijkstra(int s) {
  for (int i = 0; i < vn; i++) mark[i] = false, dist[i] = INF;
  dist[s] = 0;
  while (true) {
    int v = -1;
    for (int i = 0; i < vn; i++)
      if (mark[i] != true && (v == -1 || dist[i] < dist[v])) v = i;
    if (v == -1) break;
    mark[v] = true;
    for (int i = 0; i < vn; i++)
      if (rcap[v][i] != 0) dist[i] = min(dist[i], dist[v] + rcost[v][i]);
  }
}
int par[MAXn];
void fillPar(int s, int t) {
  for (int i = 0; i < vn; i++) par[i] = -1, mark[i] = false;
  queue<int> q;
  q.push(s);
  mark[s] = true;
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int i = 0; i < vn; i++)
      if (rcost[v][i] == 0 && rcap[v][i] != 0 && !mark[i]) {
        mark[i] = true;
        par[i] = v;
        q.push(i);
        if (i == t) return;
      }
  }
}
int maxFlow(int s, int t) {
  int flow = 0;
  while (true) {
    fillPar(s, t);
    if (par[t] == -1) break;
    int mn = INF;
    int v = t;
    while (par[v] != -1) mn = min(mn, rcap[par[v]][v]), v = par[v];
    v = t;
    flow += mn;
    while (par[v] != -1)
      rcap[par[v]][v] -= mn, rcap[v][par[v]] += mn, v = par[v];
  }
  return flow;
}
void reduce_cost() {
  for (int i = 0; i < vn; i++)
    for (int j = 0; j < vn; j++)
      if (rcap[i][j] != 0 && dist[j] != INF && dist[i] != INF)
        rcost[i][j] += dist[i] - dist[j];
}
void minCostFlow(int s, int t) {
  for (int i = 0; i < vn; i++)
    for (int j = 0; j < vn; j++)
      rcap[i][j] = cap[i][j], rcost[i][j] = cost[i][j];
  bellman(s);
  reduce_cost();
  while (true) {
    dijkstra(s);
    reduce_cost();
    int ret = maxFlow(s, t);
    if (ret == 0) return;
  }
}
int n, m;
vector<int> bitc, num;
int cc;
int var[MAXn];
void dfs(int v) {
  var[v] = cc;
  mark[v] = true;
  for (int j = v + 1; j < vn; j++)
    if (!mark[j] && cap[v][j] != rcap[v][j]) dfs(j);
}
int vvar[MAXn];
int main() {
  cin >> n >> m;
  bitc.push_back(0);
  num.push_back(0);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    num.push_back(x);
    int c = 0;
    while (x > 0) {
      c += x % 2;
      x /= 2;
    }
    bitc.push_back(c);
  }
  n++;
  for (int i = 0; i < n; i++)
    cap[in(i)][out(i)] = 1, cost[in(i)][out(i)] = -100000;
  for (int i = 0; i < (int)bitc.size(); i++)
    for (int j = i + 1; j < (int)bitc.size(); j++)
      cap[out(i)][in(j)] = 1,
      cost[out(i)][in(j)] = ((num[i] == num[j]) ? 0 : bitc[j]);
  cap[0][1] = m, cost[0][1] = 0;
  for (int i = 0; i < n; i++) cap[out(i)][2 * n] = INF, cost[out(i)][2 * n] = 0;
  vn = 2 * n + 1;
  minCostFlow(0, vn - 1);
  int c = 0;
  for (int i = 0; i < vn; i++)
    for (int j = i + 1; j < vn; j++) c += (cap[i][j] - rcap[i][j]) * cost[i][j];
  for (int i = 0; i < vn; i++) mark[i] = false;
  cc = 0;
  for (int i = 1; i < n; i++)
    if (cap[1][in(i)] != rcap[1][in(i)]) {
      cc++;
      dfs(in(i));
    }
  int count = 0;
  for (int i = 1; i < n; i++) {
    int vi = var[in(i)] - 1;
    if (num[i] != vvar[vi]) count++;
    vvar[vi] = num[i];
    count++;
  }
  for (int i = 0; i < MAXn; i++) vvar[i] = 0;
  cout << count << " " << c - (n - 1) * -100000 << endl;
  for (int i = 1; i < n; i++) {
    int vi = var[in(i)] - 1;
    char vc = 'a' + vi;
    if (num[i] != vvar[vi]) cout << vc << "=" << num[i] << endl;
    vvar[vi] = num[i];
    cout << "print(" << vc << ")" << endl;
  }
  return 0;
}
