namespace AtCoder; #nullable enable using System.Numerics; static class Extensions { public static T[] Repeat(this int time, Func F) => Enumerable.Range(0, time).Select(_ => F()).ToArray(); } class TimeLimit { long Limit { get; set; } System.Diagnostics.Stopwatch Stopwatch { get; set; } public TimeLimit(long milliseconds) { Limit = milliseconds; Stopwatch = new System.Diagnostics.Stopwatch(); Stopwatch.Start(); } public static implicit operator bool(TimeLimit tl) => tl.Stopwatch.ElapsedMilliseconds < tl.Limit; } class AtCoder { object? Solve() { var tl = new TimeLimit(6500); var n = Int(); var k = Int(); var az = n.Repeat(Int); var (lo, ro) = (0, n - 1); var df = false; var m = 1000000; var srz = (m + 1).Repeat(() => -2); srz[0] = -1; var txor = 0; for (var i = 0; i < n; i++) { var a = az[i]; txor ^= a; if (srz[txor] >= -1) { df = true; var (l, r) = (srz[txor] + 1, i); lo = Math.Max(lo, l); ro = Math.Min(ro, r); } srz[txor] = i; } if (!df) { return true; } if (lo > ro) { return false; } var d = new int[m + 1]; d[0] = 1; var dup = 0; var random = new Random(1); while (tl) { var ri = random.Next(lo, ro + 1); var ao = az[ri]; az[ri] = random.Next(Math.Max(1, ao - k), ao + k + 1); var sxor = 0; for (var i = 0; i < n; i++) { sxor ^= az[i]; d[sxor]++; if (d[sxor] == 2) dup++; } if (dup == 0) { return true; } for (var i = n - 1; i >= 0; i--) { if (d[sxor] == 2) dup--; d[sxor]--; sxor ^= az[i]; } az[ri] = ao; } return false; } public static void Main() => new AtCoder().Run(); public void Run() { var res = Solve(); if (res != null) { if (res is bool yes) res = yes ? "Yes" : "No"; sw.WriteLine(res); } sw.Flush(); } string[] input = Array.Empty(); int iter = 0; readonly StreamWriter sw = new(Console.OpenStandardOutput()) { AutoFlush = false }; #pragma warning disable IDE0051 string String() { while (iter >= input.Length) (input, iter) = (Console.ReadLine()!.Split(' '), 0); return input[iter++]; } T Input() where T : IParsable => T.Parse(String(), null); int Int() => Input(); void Out(object? x, string? separator = null) { separator ??= Environment.NewLine; if (x is System.Collections.IEnumerable obj and not string) { var firstLine = true; foreach (var item in obj) { if (!firstLine) sw.Write(separator); firstLine = false; sw.Write(item); } } else sw.Write(x); sw.WriteLine(); } #pragma warning restore IDE0051 }